package com.youxin.busfoundation.config;

import java.text.ParseException;
import java.util.List;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

import com.youxin.foundation.db.redis.RedisClusterBean;


/**
 * 监控redis结点状态的配置
 * @author yingde.cao
 *
 */
@Configuration
@PropertySource("classpath:${spring.profiles.active}/monitor.properties")
@ConfigurationProperties(prefix="monitor.cluster")
public class MonitorRedisConfig extends MonitorBaseBean{
	
	private RedisClusterBean redis;
	
	private List<MonitorRedisItem> hostslist;
	public RedisClusterBean getRedis() {
		return redis;
	}

	public void setRedis(RedisClusterBean redis) {
		this.redis = redis;
	}

	public List<MonitorRedisItem> getHostslist() {
		return hostslist;
	}

	public void setHostslist(List<MonitorRedisItem> hostslist) {
		this.hostslist = hostslist;
	}

	private static MonitorRedisConfig config;
	private static Object lockObj=new Object();	
	
	/**
	 * 程序启动时加载redis monitor的配置
	 * @param conf
	 */
	public static void initConfig(MonitorRedisConfig conf) throws ParseException
	{
		synchronized (lockObj) {
			if(config==null)
			{
				config=conf;
			}		
			
		}
	}
	
}
